package com.sline.ThreadMethod;

public class Demo7_Priority {

    /*设置优先级*/
    public static void main(String[] args) {
        Thread t1 = new Thread() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(this.getName() + "aaaaaaaaaaaaaaaa");
                }
            }
        };

        Thread t2 = new Thread() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(this.getName() + "bb");
                }
            }
        };

        t1.setPriority(10);
        t2.setPriority(1);

        t1.start();
        t2.start();
    }
}
